package com.agou.core.ss;

import com.agou.core.util.UtFormat;

public class SSTrace {

	private Class<?> logobj = null;

	private SSTrace(Class<?> obj) {
		logobj = obj;
	}

	public static SSTrace getInstance(Class<?> obj) {
		return new SSTrace(obj);
	}

	public void info(String method, String msg, Object... params) {
		printlog(method, msg, null, params);
	}

	public void info(String method, String msg, Exception e, Object... params) {
		printlog(method, msg, e, params);
	}

	public void debug(String method, String msg, Object... params) {
		printlog(method, msg, null, params);
	}

	public void debug(String method, String msg, Exception e, Object... params) {
		printlog(method, msg, e, params);
	}

	public void error(String method, String msg, Object... params) {
		printlog(method, msg, null, params);
	}

	public void error(String method, String msg, Exception e, Object... params) {
		printlog(method, msg, e, params);
	}

	public void warn(String method, String msg, Object... params) {
		printlog(method, msg, null, params);
	}

	public void warn(String method, String msg, Exception e, Object... params) {
		printlog(method, msg, e, params);
	}

	private void printlog(String method, String msg, Exception e,
			Object... params) {
		System.out.println("[" + logobj.getName() + "." + method + "()]" + UtFormat.format(msg, params));
		if (e != null) {
			e.printStackTrace();
		}
	}

	

}
